package com.mxpio.erp.common.sales.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.model.BizOrderLine;
import com.mxpioframework.security.annotation.Dict;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_SALES_SO_LINE")
@Schema(description="销售订单行")
public class SalesOrderLine extends BizOrderLine {

	private static final long serialVersionUID = 1L;

	@Column(name = "JOIN_MAIN_PLAN_")
	@Schema(description = "是否加入主计划")
	@Dict(dicCode = "ERP_COMMON_YESNO")
	private Boolean joinMainPlan ;

	@Column(name = "CST_STORE_NAME_")
	@Schema(description = "客户存货名称")
	private String cstStoreName;

	@Column(name = "CST_MAIN_METERING_")
	@Schema(description = "客户主计量")
	private String cstMainMetering;

	@Column(name = "DELIVER_DATE_")
	@Schema(description = "交付日期")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date deliverDate;

	@Column(name = "APPOINT_DELIVER_DATE_")
	@Schema(description = "指定交付日期")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date appointDeliverDate;

	@Column(name = "TAX_RATE_")
	@Schema(description = "税率")
	private BigDecimal taxRate ;

	@Column(name = "UNTAX_PRICE_")
	@Schema(description = "无税单价")
	private BigDecimal untaxPrice;

	@Column(name = "TAX_PRICE_")
	@Schema(description = "含税单价")
	private BigDecimal taxPrice;

	@Column(name = "UNTAX_AMOUNT_")
	@Schema(description = "无税金额")
	private BigDecimal untaxAmount;

	@Column(name = "TAX_")
	@Schema(description = "税额")
	private BigDecimal tax;

	@Column(name = "TOTAL_AMOUNT")
	@Schema(description = "价税合计")
	private BigDecimal totalAmount;

	@Column(name = "ADDRESS_")
	@Schema(description = "收货地址")
	private String address;

	@Column(name = "CONSIGNEE_")
	@Schema(description = "收货人")
	private String consignee;

	@Column(name = "ADDR_TEL_")
	@Schema(description = "联系电话")
	private String addrTel;

	@Column(name = "MEMO_")
	@Schema(description = "备注")
	private String memo;

	@Column(name = "DRAWING_NO_")
	@Schema(description = "图号")
	private String drawingNo;


	/*@Schema(description = "实际发货数")
	@Transient
	private BigDecimal deliverQuantity;

	@Schema(description = "实际最大可发货数")
	@Transient
	private BigDecimal actualMaxQuantity;

	@Schema(description = "计划发货数")
	@Transient
	private BigDecimal planQuantity;

	@Schema(description = "计划退货数")
	@Transient
	private BigDecimal planBackQuantity;

	@Schema(description = "实际退货数")
	@Transient
	private BigDecimal actualBackQuantity;*/

	@Transient
	private SalesOrder salesOrder;
}
